<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<%@include file="/common/head.jsp" %>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form role="form" class="form-inline" id="query-form" method="post"
                          action="${ctx }/admin/agent/checkDetail">
                        <!-- 查询开始 -->
                        <div class="form-group">
                            机构名称：${agent.orgName}
                            &nbsp;&nbsp;负责人：${agent.manager}
                            &nbsp;&nbsp;联系方式：${agent.mobile}
                        </div>
                        <br>
                        <div class="form-group">
                            <input type="hidden" value="${agent.id}" name="id"/>
                            <input type="text" class="form-control" name="startDate"
                                   value="${query.startDate}"
                                   onclick="laydate({format: 'YYYY-MM-DD'})" placeholder="开始时间" style="width: 100px">
                            至
                            <input type="text" class="form-control" name="endDate"
                                   value="${query.endDate}"
                                   onclick="laydate({format: 'YYYY-MM-DD'})" placeholder="结束时间" style="width: 100px">
                        </div>
                        &nbsp;
                        <div class="form-group">
                            <label for="query-status" class="sr-only2">账号类型</label>
                            <select name="serviceType" id="query-status" class="form-control" value="${query.servicePackage.id}">
                                <option value="">全部</option>
                                <c:forEach items="${agentServicePackageList}" var="asp">
                                    <option value="${asp.servicePackage.id}">${asp.servicePackage.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-primary btn-sm" type="submit"><i class="fa fa-search"></i>&nbsp;查询
                            </button>
                        </div>
                        <!-- 查询结束 -->
                    </form>
                    <table id="table" data-toggle="table" data-striped="true" data-click-to-select="true"
                           data-mobile-responsive="true">
                        <thead>
                        <tr>
                            <th data-field="id" data-visible="false">ID</th>
                            <th data-field="type">账号类型</th>
                            <%--<th data-field="amount">使用个数</th>--%>
                            <th data-field="organizationName">机构名称</th>
                            <th data-field="clientName">医生名称</th>
                            <th data-field="contact">联系方式</th>
                            <th data-field="date">使用时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${customerServicePackageList}" var="n" varStatus="idx">
                            <tr data-index="${idx.index }" data-id="${n.id }">
                                <td style="">${n.id }</td>
                                <td style="">${n.servicePackage.name}(${n.servicePackage.expireDays}天)</td>
                                <%--<td style="">${n.count}</td>--%>
                                <td style="">${n.customer.orgName}</td>
                                <td style="">${n.customer.name}</td>
                                <td style="">${n.customer.mobile}</td>
                                <td style=""><fmt:formatDate value="${n.created}" pattern="yyyy-MM-dd"/></td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>

                    <%@include file="/common/page.jsp" %>
                </div>
            </div>
        </div>
    </div>
</div>

<%@include file="/common/foot.jsp" %>
<script>
    var page = "${page.page}";

    function reload() {
        page_submit(page);
    }
    paging('pagination', ${page.totalPages}, ${page.page});
</script>
</body>
</html>